# HG changeset patch
# User Christophe Capon <christophe.capon@vilogia.fr>
# Date 1270091994 -7200
# Branch 5.3.0
# Node ID b193dc341426f5ed53912eb1c958f22bb01db0e0
# Parent  103954fc1f16b4f0792a8495714a3e67c717598b
Added alert utility project
Provides the ability to get localized messages from ftl

diff -r 103954fc1f16 -r b193dc341426 nuxeo-platform-alert-util/LGPL.txt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nuxeo-platform-alert-util/LGPL.txt	Thu Apr 01 05:19:54 2010 +0200
@@ -0,0 +1,504 @@
+		  GNU LESSER GENERAL PUBLIC LICENSE
+		       Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+		  GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+  
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+			    NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff -r 103954fc1f16 -r b193dc341426 nuxeo-platform-alert-util/pom.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nuxeo-platform-alert-util/pom.xml	Thu Apr 01 05:19:54 2010 +0200
@@ -0,0 +1,172 @@
+<?xml version="1.0"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.nuxeo.ecm.platform</groupId>
+    <artifactId>nuxeo-services-parent</artifactId>
+    <version>5.3.0</version>
+  </parent>
+
+  <artifactId>nuxeo-platform-alert-util</artifactId>
+  <name>Nuxeo Alert Management Service - Utilities</name>
+  <description>Nuxeo Enterprise Platform: utility classes for
+    Nuxeo Alert Management Service.</description>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.nuxeo.ecm.platform</groupId>
+      <artifactId>nuxeo-platform-usersettings-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.platform</groupId>
+      <artifactId>nuxeo-platform-usersettings-types</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.core</groupId>
+      <artifactId>nuxeo-core-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.core</groupId>
+      <artifactId>nuxeo-core-schema</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.platform</groupId>
+      <artifactId>nuxeo-platform-alert-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.theme</groupId>
+      <artifactId>nuxeo-theme-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.theme</groupId>
+      <artifactId>nuxeo-theme-html</artifactId>
+    </dependency>
+      <dependency>
+        <groupId>commons-lang</groupId>
+        <artifactId>commons-lang</artifactId>
+        <version>2.3</version>
+        <scope>provided</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.freemarker</groupId>
+        <artifactId>freemarker</artifactId>
+        <version>2.3.11</version>
+        <scope>provided</scope>
+      </dependency>
+      <dependency>
+        <groupId>javax.mail</groupId>
+        <artifactId>mail</artifactId>
+        <version>1.4</version>
+        <scope>provided</scope>
+      </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.platform</groupId>
+      <artifactId>nuxeo-platform-usersettings-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.platform</groupId>
+      <artifactId>nuxeo-platform-usersettings-types</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.platform</groupId>
+      <artifactId>nuxeo-platform-usersettings-core</artifactId>
+      <scope>tests</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.core</groupId>
+      <artifactId>nuxeo-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.core</groupId>
+      <artifactId>nuxeo-core-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.core</groupId>
+      <artifactId>nuxeo-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.runtime</groupId>
+      <artifactId>nuxeo-runtime</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.core</groupId>
+      <artifactId>nuxeo-core-jcr-connector</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.core</groupId>
+      <artifactId>nuxeo-core-jcr-connector-test</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.seam</groupId>
+      <artifactId>jboss-seam</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.platform</groupId>
+      <artifactId>nuxeo-platform-usermanager-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.platform</groupId>
+      <artifactId>nuxeo-platform-userworkspace-api</artifactId>
+    <version>5.3.0</version>
+    </dependency>
+      <dependency>
+        <groupId>org.nuxeo.ecm.platform</groupId>
+        <artifactId>nuxeo-platform-placeful-api</artifactId>
+	<scope>tests</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.nuxeo.ecm.platform</groupId>
+        <artifactId>nuxeo-platform-placeful-core</artifactId>
+	<scope>tests</scope>
+      </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.platform</groupId>
+      <artifactId>nuxeo-platform-userworkspace-core</artifactId>
+    <version>5.3.0</version>
+	<scope>tests</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.platform</groupId>
+      <artifactId>nuxeo-platform-usermanager-core</artifactId>
+	<scope>tests</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.platform</groupId>
+      <artifactId>nuxeo-platform-userworkspace-types</artifactId>
+    <version>5.3.0</version>
+	<scope>tests</scope>
+    </dependency>
+    <dependency>
+      <groupId>javax.transaction</groupId>
+      <artifactId>jta</artifactId>
+    <version>1.1</version>
+	<scope>tests</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.platform</groupId>
+      <artifactId>nuxeo-platform-usersettings-alert-types</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.platform</groupId>
+      <artifactId>nuxeo-platform-usersettings-alert-core</artifactId>
+    </dependency>
+      <dependency>
+        <groupId>org.nuxeo.ecm.platform</groupId>
+        <artifactId>nuxeo-platform-url-core</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.nuxeo.ecm.platform</groupId>
+        <artifactId>nuxeo-platform-url-facade</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.nuxeo.ecm.platform</groupId>
+        <artifactId>nuxeo-platform-url-api</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.nuxeo.ecm.platform</groupId>
+        <artifactId>nuxeo-platform-directory-types-contrib</artifactId>
+	<scope>tests</scope>
+      </dependency>
+</dependencies>
+</project>
diff -r 103954fc1f16 -r b193dc341426 nuxeo-platform-alert-util/src/main/java/org/nuxeo/ecm/alert/util/FreemarkerMethods.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nuxeo-platform-alert-util/src/main/java/org/nuxeo/ecm/alert/util/FreemarkerMethods.java	Thu Apr 01 05:19:54 2010 +0200
@@ -0,0 +1,13 @@
+package org.nuxeo.ecm.alert.util;
+
+import org.nuxeo.ecm.platform.rendering.impl.DefaultRenderingContext;
+
+public class FreemarkerMethods {
+
+    public static void add(DefaultRenderingContext ctx) {
+    
+        ctx.put("message", new GetMessageMethod());
+
+    }
+    
+}
diff -r 103954fc1f16 -r b193dc341426 nuxeo-platform-alert-util/src/main/java/org/nuxeo/ecm/alert/util/GetMessageMethod.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nuxeo-platform-alert-util/src/main/java/org/nuxeo/ecm/alert/util/GetMessageMethod.java	Thu Apr 01 05:19:54 2010 +0200
@@ -0,0 +1,26 @@
+package org.nuxeo.ecm.alert.util;
+
+import java.util.List;
+
+import org.jboss.seam.international.Messages;
+
+import freemarker.template.TemplateMethodModel;
+import freemarker.template.TemplateModelException;
+
+public class GetMessageMethod implements TemplateMethodModel {
+
+    @SuppressWarnings("unchecked")
+    public synchronized String exec(List args) throws TemplateModelException {
+
+        if (args.size() != 1) {
+            throw new TemplateModelException("Wrong arguments");
+        }
+
+        String key = (String) args.get(0);
+        if (Messages.instance().containsKey(key)) {
+            return (String) Messages.instance().get(key);
+        } else {
+            return key;
+        }
+    }
+}
diff -r 103954fc1f16 -r b193dc341426 nuxeo-platform-alert-util/src/main/resources/META-INF/MANIFEST.MF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nuxeo-platform-alert-util/src/main/resources/META-INF/MANIFEST.MF	Thu Apr 01 05:19:54 2010 +0200
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Nuxeo ECM Alert Core
+Bundle-SymbolicName: org.nuxeo.ecm.alert.util;singleton:=true
+Bundle-Vendor: Nuxeo
+Bundle-Localization: bundle
+Bundle-ClassPath: .
+Bundle-Category: web,stateful
+Export-Package: org.nuxeo.ecm.alert.util
+Eclipse-LazyStart: true
+Require-Bundle: org.nuxeo.ecm.core.api,
+ org.nuxeo.ecm.core.event,
+ org.nuxeo.ecm.platform.notification.core,
+ org.nuxeo.ecm.alert.api
+ 
\ No newline at end of file
diff -r 103954fc1f16 -r b193dc341426 nuxeo-platform-alert-util/src/main/resources/OSGI-INF/deployment-fragment.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nuxeo-platform-alert-util/src/main/resources/OSGI-INF/deployment-fragment.xml	Thu Apr 01 05:19:54 2010 +0200
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+
+<fragment>
+
+	<extension target="application#MODULE">
+		<module>
+			<java>${bundle.fileName}</java>
+		</module>
+	</extension>
+
+</fragment>
diff -r 103954fc1f16 -r b193dc341426 pom.xml
--- a/pom.xml	Mon Mar 29 10:27:20 2010 +0200
+++ b/pom.xml	Thu Apr 01 05:19:54 2010 +0200
@@ -38,10 +38,12 @@
     <module>nuxeo-platform-deferredalert-core</module>
     <module>nuxeo-platform-alert-api</module>
     <module>nuxeo-platform-alert-core</module>
+    <module>nuxeo-platform-alert-util</module>
     <module>nuxeo-platform-alert-test</module>
     <module>nuxeo-platform-alert-lock-core</module>
     <module>nuxeo-platform-alert-task-core</module>
     <module>nuxeo-platform-alert-deferred-core</module>
+    <module>nuxeo-platform-alert-obsolete-core</module>
     <module>nuxeo-platform-notification-core</module>
   </modules>
 
@@ -815,6 +817,11 @@
       </dependency>
       <dependency>
         <groupId>org.nuxeo.ecm.platform</groupId>
+        <artifactId>nuxeo-platform-alert-util</artifactId>
+        <version>${nuxeo.services.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.nuxeo.ecm.platform</groupId>
         <artifactId>nuxeo-platform-alert-lock-core</artifactId>
         <version>${nuxeo.services.version}</version>
       </dependency>
@@ -828,6 +835,11 @@
         <artifactId>nuxeo-platform-alert-deferred-core</artifactId>
         <version>${nuxeo.services.version}</version>
       </dependency>
+      <dependency>
+        <groupId>org.nuxeo.ecm.platform</groupId>
+        <artifactId>nuxeo-platform-alert-obsolete-core</artifactId>
+        <version>${nuxeo.services.version}</version>
+      </dependency>
 
 
       <!-- scope test -->
# HG changeset patch
# User Christophe Capon <christophe.capon@vilogia.fr>
# Date 1270092178 -7200
# Branch 5.3.0
# Node ID da9260dcce12b38f7c9b5bfb3294c8bc8e6becfe
# Parent  b193dc341426f5ed53912eb1c958f22bb01db0e0
Expired document alerts

diff -r b193dc341426 -r da9260dcce12 nuxeo-platform-alert-obsolete-core/pom.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nuxeo-platform-alert-obsolete-core/pom.xml	Thu Apr 01 05:22:58 2010 +0200
@@ -0,0 +1,193 @@
+<?xml version="1.0"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.nuxeo.ecm.platform</groupId>
+    <artifactId>nuxeo-services-parent</artifactId>
+    <version>5.3.0</version>
+  </parent>
+
+  <artifactId>nuxeo-platform-alert-obsolete-core</artifactId>
+  <name>Nuxeo Task Alert Provider - Core</name>
+  <description>Nuxeo Enterprise Platform: implementation for
+    Nuxeo Alert Management Service.</description>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.nuxeo.ecm.platform</groupId>
+      <artifactId>nuxeo-platform-usersettings-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.platform</groupId>
+      <artifactId>nuxeo-platform-usersettings-types</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.core</groupId>
+      <artifactId>nuxeo-core-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.core</groupId>
+      <artifactId>nuxeo-core-schema</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.platform</groupId>
+      <artifactId>nuxeo-platform-alert-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.platform</groupId>
+      <artifactId>nuxeo-platform-alert-util</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.theme</groupId>
+      <artifactId>nuxeo-theme-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.theme</groupId>
+      <artifactId>nuxeo-theme-html</artifactId>
+    </dependency>
+      <dependency>
+        <groupId>commons-lang</groupId>
+        <artifactId>commons-lang</artifactId>
+        <version>2.3</version>
+        <scope>provided</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.freemarker</groupId>
+        <artifactId>freemarker</artifactId>
+        <version>2.3.11</version>
+        <scope>provided</scope>
+      </dependency>
+      <dependency>
+        <groupId>javax.mail</groupId>
+        <artifactId>mail</artifactId>
+        <version>1.4</version>
+        <scope>provided</scope>
+      </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.platform</groupId>
+      <artifactId>nuxeo-platform-usersettings-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.platform</groupId>
+      <artifactId>nuxeo-platform-usersettings-types</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.platform</groupId>
+      <artifactId>nuxeo-platform-usersettings-core</artifactId>
+      <scope>tests</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.core</groupId>
+      <artifactId>nuxeo-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.core</groupId>
+      <artifactId>nuxeo-core-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.core</groupId>
+      <artifactId>nuxeo-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.runtime</groupId>
+      <artifactId>nuxeo-runtime</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.core</groupId>
+      <artifactId>nuxeo-core-jcr-connector</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.core</groupId>
+      <artifactId>nuxeo-core-jcr-connector-test</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.seam</groupId>
+      <artifactId>jboss-seam</artifactId>
+    </dependency>
+      <dependency>
+        <groupId>org.jbpm.jbpm3</groupId>
+        <artifactId>jbpm-jpdl</artifactId>
+        <version>3.3.0.GA</version>
+      </dependency>
+      <dependency>
+        <groupId>org.nuxeo.ecm.platform</groupId>
+        <artifactId>nuxeo-platform-jbpm-api</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.nuxeo.ecm.platform</groupId>
+        <artifactId>nuxeo-platform-jbpm-test</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+
+    <dependency>
+      <groupId>org.nuxeo.ecm.platform</groupId>
+      <artifactId>nuxeo-platform-usermanager-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.platform</groupId>
+      <artifactId>nuxeo-platform-userworkspace-api</artifactId>
+    <version>5.3.0</version>
+    </dependency>
+      <dependency>
+        <groupId>org.nuxeo.ecm.platform</groupId>
+        <artifactId>nuxeo-platform-placeful-api</artifactId>
+	<scope>tests</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.nuxeo.ecm.platform</groupId>
+        <artifactId>nuxeo-platform-placeful-core</artifactId>
+	<scope>tests</scope>
+      </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.platform</groupId>
+      <artifactId>nuxeo-platform-userworkspace-core</artifactId>
+    <version>5.3.0</version>
+	<scope>tests</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.platform</groupId>
+      <artifactId>nuxeo-platform-usermanager-core</artifactId>
+	<scope>tests</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.platform</groupId>
+      <artifactId>nuxeo-platform-userworkspace-types</artifactId>
+    <version>5.3.0</version>
+	<scope>tests</scope>
+    </dependency>
+    <dependency>
+      <groupId>javax.transaction</groupId>
+      <artifactId>jta</artifactId>
+    <version>1.1</version>
+	<scope>tests</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.platform</groupId>
+      <artifactId>nuxeo-platform-usersettings-alert-types</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.nuxeo.ecm.platform</groupId>
+      <artifactId>nuxeo-platform-usersettings-alert-core</artifactId>
+	<scope>tests</scope>
+    </dependency>
+      <dependency>
+        <groupId>org.nuxeo.ecm.platform</groupId>
+        <artifactId>nuxeo-platform-url-core</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.nuxeo.ecm.platform</groupId>
+        <artifactId>nuxeo-platform-url-facade</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.nuxeo.ecm.platform</groupId>
+        <artifactId>nuxeo-platform-url-api</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.nuxeo.ecm.platform</groupId>
+        <artifactId>nuxeo-platform-directory-types-contrib</artifactId>
+	<scope>tests</scope>
+      </dependency>
+</dependencies>
+</project>
diff -r b193dc341426 -r da9260dcce12 nuxeo-platform-alert-obsolete-core/src/main/java/org/nuxeo/ecm/alert/obsolete/core/DocumentInfo.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nuxeo-platform-alert-obsolete-core/src/main/java/org/nuxeo/ecm/alert/obsolete/core/DocumentInfo.java	Thu Apr 01 05:22:58 2010 +0200
@@ -0,0 +1,61 @@
+package org.nuxeo.ecm.alert.obsolete.core;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public class DocumentInfo {
+
+    private static SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
+
+    private String docUrl;
+
+    private String docTitle;
+
+    public Date getExpiredDate() {
+        return expiredDate;
+    }
+
+    public void setExpiredDate(Date expiredDate) {
+        this.expiredDate = expiredDate;
+    }
+
+    public boolean isExpired() {
+        return expired;
+    }
+
+    public boolean getExpired() {
+        return expired;
+    }
+
+    public void setExpired(boolean expired) {
+        this.expired = expired;
+    }
+
+    private Date expiredDate;
+
+    private boolean expired;
+
+    public void setDocUrl(String docUrl) {
+        this.docUrl = docUrl;
+    }
+
+    public String getDocUrl() {
+        return docUrl;
+    }
+
+    public void setDocTitle(String docTitle) {
+        this.docTitle = docTitle;
+    }
+
+    public String getDocTitle() {
+        return docTitle;
+    }
+
+    public String getExpiredDateStr() {
+        if (expiredDate == null)
+            return "-";
+        else
+            return df.format(expiredDate);
+    }
+
+}
diff -r b193dc341426 -r da9260dcce12 nuxeo-platform-alert-obsolete-core/src/main/java/org/nuxeo/ecm/alert/obsolete/core/ObsoleteAlertProvider.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nuxeo-platform-alert-obsolete-core/src/main/java/org/nuxeo/ecm/alert/obsolete/core/ObsoleteAlertProvider.java	Thu Apr 01 05:22:58 2010 +0200
@@ -0,0 +1,181 @@
+package org.nuxeo.ecm.alert.obsolete.core;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuxeo.ecm.alert.Alert;
+import org.nuxeo.ecm.alert.AlertContext;
+import org.nuxeo.ecm.alert.AlertProvider;
+import org.nuxeo.ecm.alert.UserAlerts;
+import org.nuxeo.ecm.alert.util.FreemarkerMethods;
+import org.nuxeo.ecm.core.api.ClientException;
+import org.nuxeo.ecm.core.api.CoreSession;
+import org.nuxeo.ecm.core.api.DocumentLocation;
+import org.nuxeo.ecm.core.api.DocumentModel;
+import org.nuxeo.ecm.core.api.DocumentModelList;
+import org.nuxeo.ecm.core.api.DocumentRef;
+import org.nuxeo.ecm.core.api.impl.DocumentLocationImpl;
+import org.nuxeo.ecm.platform.ec.notification.service.NotificationServiceHelper;
+import org.nuxeo.ecm.platform.rendering.RenderingResult;
+import org.nuxeo.ecm.platform.rendering.RenderingService;
+import org.nuxeo.ecm.platform.url.DocumentViewImpl;
+import org.nuxeo.ecm.platform.url.api.DocumentView;
+import org.nuxeo.ecm.platform.url.api.DocumentViewCodecManager;
+import org.nuxeo.em.usersettings.alert.types.AlertSettingsWrapper;
+import org.nuxeo.runtime.api.Framework;
+
+public class ObsoleteAlertProvider implements AlertProvider {
+
+    private DocumentViewCodecManager docLocator = null;
+
+    private static final Log log = LogFactory.getLog(ObsoleteAlertProvider.class);
+
+    public Map<String, UserAlerts> getAllPendingAlerts(CoreSession coreSession)
+            throws ClientException {
+
+        Map<String, UserAlerts> result = new HashMap<String, UserAlerts>();
+        
+        // NULL is not handled
+        String query = "select * from Document where dc:expired between '1980-01-01' and '2200-01-01' ";
+
+        DocumentModelList docs = coreSession.query(query);
+
+        for (DocumentModel doc : docs) {
+            String userName = (String) doc.getProperty("dublincore", "creator");
+            UserAlerts ua = getCurrentUserAlerts(result, userName);
+            ua.setUserName(userName);
+            ua.getAlerts().add(
+                    new Alert("ObsoleteAlertProvider", "obsolete", doc.getRef()));
+        }
+
+        return result;
+
+    }
+
+    private UserAlerts getCurrentUserAlerts(Map<String, UserAlerts> result,
+            String userName) {
+
+        if (!result.containsKey(userName)) {
+
+            UserAlerts alerts = new UserAlerts(userName);
+
+            result.put(userName, alerts);
+
+        }
+
+        UserAlerts alerts = result.get(userName);
+
+        return alerts;
+    }
+
+    public String renderAlerts(CoreSession coreSession, RenderingService rs,
+            String userName, List<Alert> alerts, DocumentModel userSettingsDoc,
+            AlertContext ctxt) {
+
+        String result = "";
+
+        try {
+
+            AlertSettingsWrapper w = new AlertSettingsWrapper(userSettingsDoc);
+
+            if (!w.getIncludeExpiredDocuments())
+                return result;
+
+            List<DocumentInfo> docs = new ArrayList<DocumentInfo>();
+
+            for (Alert a : alerts) {
+
+                if (a.getAlertProviderName() == "ObsoleteAlertProvider") {
+
+                    DocumentModel dm = coreSession.getDocument((DocumentRef) a.getAlertData());
+                    DocumentInfo di = getEligibleDocInfo(dm, w);
+                    if (null != di) {
+                        docs.add(di);
+                    }
+
+                }
+
+            }
+
+            ObsoleteRenderingContext ctx = new ObsoleteRenderingContext();
+            ctx.put("template", "obsoleteAlert");
+            ctx.put("docs", docs);
+            ctx.put("format", w.getAlertDeliveryChannel());
+            FreemarkerMethods.add(ctx);
+
+            Collection<RenderingResult> render = rs.process(ctx);
+            if (render.size() > 0) {
+                result = (String) render.iterator().next().getOutcome();
+            }
+        } catch (Exception e) {
+            log.error("Unable to render obsolete alerts", e);
+        }
+
+        return result;
+
+    }
+
+    private DocumentInfo getEligibleDocInfo(DocumentModel dm, AlertSettingsWrapper w)
+            throws ClientException {
+
+        Date now = new Date();
+        
+        Calendar dueCal = (Calendar) dm.getProperty("dublincore", "expired");
+        Date due = dueCal.getTime();
+        long days = (due.getTime() - now.getTime()) / (1000 * 60 * 60 * 24);
+
+        if (w.getIncludeExpiredDocuments() && (due.before(now) || days <= w.getIncludeExpiredDocumentsDelay())) {
+            DocumentInfo di = new DocumentInfo();
+            di.setDocTitle(dm.getTitle());
+            di.setDocUrl(getDocLocation(dm));
+            di.setExpired(due.before(now));
+            di.setExpiredDate(due);
+            return di;
+        }
+
+        return null;
+
+    }
+
+    public DocumentViewCodecManager getLocator() {
+
+        if (docLocator == null) {
+            try {
+                docLocator = Framework.getService(DocumentViewCodecManager.class);
+            } catch (Exception e) {
+
+            }
+        }
+
+        return docLocator;
+    }
+
+    public String getDocLocation(DocumentModel doc) {
+
+        DocumentLocation docLoc = new DocumentLocationImpl(doc);
+        DocumentView docView = new DocumentViewImpl(docLoc);
+        docView.setViewId("view_documents");
+
+        return getLocator().getUrlFromDocumentView(
+                docView,
+                true,
+                NotificationServiceHelper.getNotificationService().getServerUrlPrefix());
+
+    }
+
+    public List<String> getTemplateList() {
+
+        List<String> result = new ArrayList<String>();
+        result.add("obsoleteAlert");
+        return result;
+
+    }
+
+}
diff -r b193dc341426 -r da9260dcce12 nuxeo-platform-alert-obsolete-core/src/main/java/org/nuxeo/ecm/alert/obsolete/core/ObsoleteRenderingContext.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nuxeo-platform-alert-obsolete-core/src/main/java/org/nuxeo/ecm/alert/obsolete/core/ObsoleteRenderingContext.java	Thu Apr 01 05:22:58 2010 +0200
@@ -0,0 +1,42 @@
+package org.nuxeo.ecm.alert.obsolete.core;
+
+import java.util.List;
+
+import org.nuxeo.ecm.core.api.DocumentModel;
+import org.nuxeo.ecm.platform.rendering.RenderingEngine;
+import org.nuxeo.ecm.platform.rendering.impl.DefaultRenderingContext;
+
+public class ObsoleteRenderingContext extends DefaultRenderingContext {
+
+    private static final long serialVersionUID = 1626664498541223492L;
+
+    public static final String CTX_PARAM_DOCUMENTS = "docs";
+
+    @Override
+    public <T> T getAdapter(Class<T> adapter) {
+        if (adapter.isAssignableFrom(getClass())) {
+            return adapter.cast(this);
+        } else if (adapter.isAssignableFrom(DocumentModel.class)) {
+            return adapter.cast(getDocuments());
+        }
+        return null;
+    }
+
+    public void setDocuments(List<DocumentModel> doc) {
+        put(CTX_PARAM_DOCUMENTS, doc);
+    }
+
+    @SuppressWarnings("unchecked")
+    public List<DocumentModel> getDocuments() {
+        return (List<DocumentModel>) get(CTX_PARAM_DOCUMENTS);
+    }
+
+    @Override
+    public boolean accept(RenderingEngine engine) {
+        if (engine.getFormatName().equals("obsoleteAlert"))
+            return true;
+        else
+            return false;
+    }
+
+}
\ No newline at end of file
diff -r b193dc341426 -r da9260dcce12 nuxeo-platform-alert-obsolete-core/src/main/resources/META-INF/MANIFEST.MF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nuxeo-platform-alert-obsolete-core/src/main/resources/META-INF/MANIFEST.MF	Thu Apr 01 05:22:58 2010 +0200
@@ -0,0 +1,20 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Nuxeo ECM Alert Core
+Bundle-SymbolicName: org.nuxeo.ecm.alert.obsolete.core;singleton:=true
+Bundle-Vendor: Nuxeo
+Bundle-Localization: bundle
+Bundle-ClassPath: .
+Bundle-Category: web,stateful
+Export-Package: org.nuxeo.ecm.alert.obsolete.core
+Eclipse-LazyStart: true
+Nuxeo-Component: OSGI-INF/obsolete-alerts-service-contrib.xml,
+ OSGI-INF/obsolete-alerts-notification-contrib.xml
+Require-Bundle: org.nuxeo.ecm.core.api,
+ org.nuxeo.ecm.core.event,
+ org.nuxeo.ecm.platform.notification.core,
+ org.nuxeo.ecm.platform.jbpm.core,
+ org.nuxeo.ecm.platform.jbpm.web,
+ org.nuxeo.ecm.platform.jbpm.api, 
+ org.nuxeo.ecm.alert.api
+ 
\ No newline at end of file
diff -r b193dc341426 -r da9260dcce12 nuxeo-platform-alert-obsolete-core/src/main/resources/OSGI-INF/deployment-fragment.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nuxeo-platform-alert-obsolete-core/src/main/resources/OSGI-INF/deployment-fragment.xml	Thu Apr 01 05:22:58 2010 +0200
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+
+<fragment>
+
+	<extension target="application#MODULE">
+		<module>
+			<java>${bundle.fileName}</java>
+		</module>
+	</extension>
+
+	<install>
+		<!--  create a temp dir -->
+		<!--  be sure no directory with that name exists -->
+		<delete path="${bundle.fileName}.tmp" />
+		<mkdir path="${bundle.fileName}.tmp" />
+
+		<unzip from="${bundle.fileName}" to="${bundle.fileName}.tmp">
+			<include>OSGI-INF/l10n/**</include>
+		</unzip>
+
+		<append from="${bundle.fileName}.tmp/OSGI-INF/l10n/messages.properties"
+			to="nuxeo.war/WEB-INF/classes/messages.properties" addNewLine="true" />
+		<append from="${bundle.fileName}.tmp/OSGI-INF/l10n/messages_en.properties"
+			to="nuxeo.war/WEB-INF/classes/messages_en.properties" addNewLine="true" />
+		<append from="${bundle.fileName}.tmp/OSGI-INF/l10n/messages_fr.properties"
+			to="nuxeo.war/WEB-INF/classes/messages_fr.properties" addNewLine="true" />
+
+		<delete path="${bundle.fileName}.tmp" />
+
+	</install>
+
+
+</fragment>
diff -r b193dc341426 -r da9260dcce12 nuxeo-platform-alert-obsolete-core/src/main/resources/OSGI-INF/l10n/messages.properties
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nuxeo-platform-alert-obsolete-core/src/main/resources/OSGI-INF/l10n/messages.properties	Thu Apr 01 05:22:58 2010 +0200
@@ -0,0 +1,4 @@
+obsolete.message.title=Expired documents
+obsolete.message.expireddate=Expiration date
+obsolete.message.document=Document
+obsolete.message.empty=No document expired
\ No newline at end of file
diff -r b193dc341426 -r da9260dcce12 nuxeo-platform-alert-obsolete-core/src/main/resources/OSGI-INF/l10n/messages_en.properties
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nuxeo-platform-alert-obsolete-core/src/main/resources/OSGI-INF/l10n/messages_en.properties	Thu Apr 01 05:22:58 2010 +0200
@@ -0,0 +1,4 @@
+obsolete.message.title=Expired documents
+obsolete.message.expireddate=Expiration date
+obsolete.message.document=Document
+obsolete.message.empty=No document expired
\ No newline at end of file
diff -r b193dc341426 -r da9260dcce12 nuxeo-platform-alert-obsolete-core/src/main/resources/OSGI-INF/l10n/messages_fr.properties
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nuxeo-platform-alert-obsolete-core/src/main/resources/OSGI-INF/l10n/messages_fr.properties	Thu Apr 01 05:22:58 2010 +0200
@@ -0,0 +1,4 @@
+obsolete.message.title=Documents obsol�tes
+obsolete.message.expireddate=Date d'expiration
+obsolete.message.document=Document
+obsolete.message.empty=Aucun document obsol�te
\ No newline at end of file
diff -r b193dc341426 -r da9260dcce12 nuxeo-platform-alert-obsolete-core/src/main/resources/OSGI-INF/obsolete-alerts-notification-contrib.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nuxeo-platform-alert-obsolete-core/src/main/resources/OSGI-INF/obsolete-alerts-notification-contrib.xml	Thu Apr 01 05:22:58 2010 +0200
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+
+<component
+  name="org.nuxeo.ecm.alert.obsolete.core.NotificationContrib">
+
+  <extension
+    target="org.nuxeo.ecm.platform.ec.notification.service.NotificationService"
+    point="templates">
+
+    <template name="obsoleteAlert" src="templates/obsoleteAlert.ftl" />
+
+  </extension>
+
+</component>
\ No newline at end of file
diff -r b193dc341426 -r da9260dcce12 nuxeo-platform-alert-obsolete-core/src/main/resources/OSGI-INF/obsolete-alerts-service-contrib.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nuxeo-platform-alert-obsolete-core/src/main/resources/OSGI-INF/obsolete-alerts-service-contrib.xml	Thu Apr 01 05:22:58 2010 +0200
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<component
+	name="org.nuxeo.ecm.alert.obsolete.core.ObsoleteAlertProvider">
+
+	<require>org.nuxeo.ecm.alert.AlertManagementService</require>
+	
+	<extension target="org.nuxeo.ecm.alert.AlertManagementServiceImplComponent"
+		point="alertProvider">
+		
+		<alertProvider name="obsolete"
+			class="org.nuxeo.ecm.alert.obsolete.core.ObsoleteAlertProvider">
+
+		</alertProvider>
+
+	</extension>
+
+</component>
\ No newline at end of file
diff -r b193dc341426 -r da9260dcce12 nuxeo-platform-alert-obsolete-core/src/main/resources/templates/obsoleteAlert.ftl
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nuxeo-platform-alert-obsolete-core/src/main/resources/templates/obsoleteAlert.ftl	Thu Apr 01 05:22:58 2010 +0200
@@ -0,0 +1,51 @@
+<div class="tabsBar">
+<ul><li class="selected"><a>${message("obsolete.message.title")}</a></li></ul>
+</div>
+
+<#if docs?has_content>
+
+	<div class="tabsContent">
+	<table class="dataOutput">
+		<thead>
+			<tr>
+				<th width="100px">${message("obsolete.message.expireddate")}</th>
+				<th>${message("obsolete.message.document")}</th>
+			</tr>
+		</thead>
+		<tbody>
+		
+			<#assign x = 1>
+		  	<#list docs as doc>  
+		  	
+		  		<#if doc.expired>
+		  			<#assign errorcls = "class=\"error\"">
+		  		<#else>
+		  			<#assign errorcls = "">
+		  		</#if>
+		  			
+		  		<#if x%2 == 0>
+				<tr class="dataRowEven">
+					<td ${errorcls}>${doc.expiredDateStr}</td>
+					<td><a href="${doc.docUrl}">${doc.docTitle}</a></td>
+				</tr>
+				</#if>
+		  		<#if x%2 == 1>
+				<tr class="dataRowOdd">
+					<td ${errorcls}>${doc.expiredDateStr}</td>
+					<td><a href="${doc.docUrl}">${doc.docTitle}</a></td>
+				</tr>
+				</#if>
+				<#assign x = x + 1>
+			</#list>
+		</tbody>
+	
+	</table>
+	</div>
+	
+<#else>
+	
+	<div>
+	<p class="currentDocumentDescription">${message("obsolete.message.empty")}<br/></p>
+	</div>
+	
+</#if>
\ No newline at end of file
# HG changeset patch
# User Christophe Capon <christophe.capon@vilogia.fr>
# Date 1270092345 -7200
# Branch 5.3.0
# Node ID 02a9f35407df4c98bd1735caf6c531827562714d
# Parent  da9260dcce12b38f7c9b5bfb3294c8bc8e6becfe
Internationalization support

diff -r da9260dcce12 -r 02a9f35407df nuxeo-platform-alert-deferred-core/pom.xml
--- a/nuxeo-platform-alert-deferred-core/pom.xml	Thu Apr 01 05:22:58 2010 +0200
+++ b/nuxeo-platform-alert-deferred-core/pom.xml	Thu Apr 01 05:25:45 2010 +0200
@@ -39,6 +39,10 @@
       <artifactId>nuxeo-platform-alert-api</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.nuxeo.ecm.platform</groupId>
+      <artifactId>nuxeo-platform-alert-util</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.nuxeo.theme</groupId>
       <artifactId>nuxeo-theme-core</artifactId>
     </dependency>
diff -r da9260dcce12 -r 02a9f35407df nuxeo-platform-alert-deferred-core/src/main/java/org/nuxeo/ecm/alert/deferred/core/DeferredAlertProvider.java
--- a/nuxeo-platform-alert-deferred-core/src/main/java/org/nuxeo/ecm/alert/deferred/core/DeferredAlertProvider.java	Thu Apr 01 05:22:58 2010 +0200
+++ b/nuxeo-platform-alert-deferred-core/src/main/java/org/nuxeo/ecm/alert/deferred/core/DeferredAlertProvider.java	Thu Apr 01 05:25:45 2010 +0200
@@ -9,10 +9,12 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.jboss.seam.international.Messages;
 import org.nuxeo.ecm.alert.Alert;
 import org.nuxeo.ecm.alert.AlertContext;
 import org.nuxeo.ecm.alert.AlertProvider;
 import org.nuxeo.ecm.alert.UserAlerts;
+import org.nuxeo.ecm.alert.util.FreemarkerMethods;
 import org.nuxeo.ecm.core.api.ClientException;
 import org.nuxeo.ecm.core.api.CoreSession;
 import org.nuxeo.ecm.core.api.DocumentLocation;
@@ -31,6 +33,10 @@
 
 import com.nuxeo.ecm.deferredalert.types.DeferredAlertWrapper;
 
+import freemarker.template.TemplateMethodModel;
+import freemarker.template.TemplateModel;
+import freemarker.template.TemplateModelException;
+
 public class DeferredAlertProvider implements AlertProvider {
 
     private DocumentViewCodecManager docLocator = null;
@@ -129,6 +135,7 @@
             ctx.put("template", "deferredAlert");
             ctx.put("alerts", alertList);
             ctx.put("format", w.getAlertDeliveryChannel());
+            FreemarkerMethods.add(ctx);
 
             Collection<RenderingResult> render = rs.process(ctx);
             if (render.size() > 0) {
@@ -215,4 +222,4 @@
 
     }
 
-}
+ }
diff -r da9260dcce12 -r 02a9f35407df nuxeo-platform-alert-deferred-core/src/main/java/org/nuxeo/ecm/alert/deferred/core/DeferredRenderingContext.java
--- a/nuxeo-platform-alert-deferred-core/src/main/java/org/nuxeo/ecm/alert/deferred/core/DeferredRenderingContext.java	Thu Apr 01 05:22:58 2010 +0200
+++ b/nuxeo-platform-alert-deferred-core/src/main/java/org/nuxeo/ecm/alert/deferred/core/DeferredRenderingContext.java	Thu Apr 01 05:25:45 2010 +0200
@@ -2,6 +2,7 @@
 
 import java.util.List;
 
+import org.jboss.seam.international.Messages;
 import org.nuxeo.ecm.core.api.DocumentModel;
 import org.nuxeo.ecm.platform.rendering.RenderingEngine;
 import org.nuxeo.ecm.platform.rendering.impl.DefaultRenderingContext;
@@ -38,5 +39,6 @@
         else
             return false;
     }
+    
 
 }
\ No newline at end of file
diff -r da9260dcce12 -r 02a9f35407df nuxeo-platform-alert-deferred-core/src/main/resources/OSGI-INF/deployment-fragment.xml
--- a/nuxeo-platform-alert-deferred-core/src/main/resources/OSGI-INF/deployment-fragment.xml	Thu Apr 01 05:22:58 2010 +0200
+++ b/nuxeo-platform-alert-deferred-core/src/main/resources/OSGI-INF/deployment-fragment.xml	Thu Apr 01 05:25:45 2010 +0200
@@ -7,5 +7,27 @@
 			<java>${bundle.fileName}</java>
 		</module>
 	</extension>
+	
+	<install>
+		<!--  create a temp dir -->
+		<!--  be sure no directory with that name exists -->
+		<delete path="${bundle.fileName}.tmp" />
+		<mkdir path="${bundle.fileName}.tmp" />
+
+		<unzip from="${bundle.fileName}" to="${bundle.fileName}.tmp">
+			<include>OSGI-INF/l10n/**</include>
+		</unzip>
+
+		<append from="${bundle.fileName}.tmp/OSGI-INF/l10n/messages.properties"
+			to="nuxeo.war/WEB-INF/classes/messages.properties" addNewLine="true" />
+		<append from="${bundle.fileName}.tmp/OSGI-INF/l10n/messages_en.properties"
+			to="nuxeo.war/WEB-INF/classes/messages_en.properties" addNewLine="true" />
+		<append from="${bundle.fileName}.tmp/OSGI-INF/l10n/messages_fr.properties"
+			to="nuxeo.war/WEB-INF/classes/messages_fr.properties" addNewLine="true" />
+
+		<delete path="${bundle.fileName}.tmp" />
+
+	</install>
+
 
 </fragment>
diff -r da9260dcce12 -r 02a9f35407df nuxeo-platform-alert-deferred-core/src/main/resources/OSGI-INF/l10n/messages.properties
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nuxeo-platform-alert-deferred-core/src/main/resources/OSGI-INF/l10n/messages.properties	Thu Apr 01 05:25:45 2010 +0200
@@ -0,0 +1,4 @@
+deferredAlert.message.title=Your subscriptions
+deferredAlert.message.date=Notification date
+deferredAlert.message.event=Notification message
+deferredAlert.message.empty=No pending messages
diff -r da9260dcce12 -r 02a9f35407df nuxeo-platform-alert-deferred-core/src/main/resources/OSGI-INF/l10n/messages_en.properties
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nuxeo-platform-alert-deferred-core/src/main/resources/OSGI-INF/l10n/messages_en.properties	Thu Apr 01 05:25:45 2010 +0200
@@ -0,0 +1,4 @@
+deferredAlert.message.title=Your subscriptions
+deferredAlert.message.date=Notification date
+deferredAlert.message.event=Notification message
+deferredAlert.message.empty=No pending messages
diff -r da9260dcce12 -r 02a9f35407df nuxeo-platform-alert-deferred-core/src/main/resources/OSGI-INF/l10n/messages_fr.properties
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nuxeo-platform-alert-deferred-core/src/main/resources/OSGI-INF/l10n/messages_fr.properties	Thu Apr 01 05:25:45 2010 +0200
@@ -0,0 +1,4 @@
+deferredAlert.message.title=Vos abonnements
+deferredAlert.message.date=Date de notification
+deferredAlert.message.event=Message
+deferredAlert.message.empty=Aucun message en attente
diff -r da9260dcce12 -r 02a9f35407df nuxeo-platform-alert-deferred-core/src/main/resources/templates/deferredAlert.ftl
--- a/nuxeo-platform-alert-deferred-core/src/main/resources/templates/deferredAlert.ftl	Thu Apr 01 05:22:58 2010 +0200
+++ b/nuxeo-platform-alert-deferred-core/src/main/resources/templates/deferredAlert.ftl	Thu Apr 01 05:25:45 2010 +0200
@@ -1,36 +1,46 @@
 <div class="tabsBar">
-<ul><li class="selected"><a>Vos abonnements</a></li></ul>
+<ul><li class="selected"><a>${message("deferredAlert.message.title")}</a></li></ul>
 </div>
-<div class="tabsContent">
-<table class="dataOutput">
-	<thead>
-		<tr>
-			<th width="150px" >Date</th>
-			<th>Evenement</th>
-		</tr>
-	</thead>
-	<tbody>
-	
-		<#assign x = 1>
-	  	<#list alerts as alert>  
-	  	
-  			<#assign errorcls = "">
-	  			
-	  		<#if x%2 == 0>
-			<tr class="dataRowEven">
-				<td ${errorcls}>${alert.alertDate}</td>
-				<td>${alert.alertText}</a></td>
-			</tr>
-			</#if>
-	  		<#if x%2 == 1>
-			<tr class="dataRowOdd">
-				<td ${errorcls}>${alert.alertDate}</td>
-				<td>${alert.alertText}</a></td>
-			</tr>
-			</#if>
-			<#assign x = x + 1>
-		</#list>
-	</tbody>
 
-</table>
-</div>
+<#if alerts?has_content>
+
+	<div class="tabsContent">
+		<table class="dataOutput">
+			<thead>
+				<tr>
+					<th width="150px" >${message("deferredAlert.message.date")}</th>
+					<th>${message("deferredAlert.message.event")}</th>
+				</tr>
+			</thead>
+			<tbody>
+			
+				<#assign x = 1>
+			  	<#list alerts as alert>  
+			  	
+		  			<#assign errorcls = "">
+			  			
+			  		<#if x%2 == 0>
+					<tr class="dataRowEven">
+						<td ${errorcls}>${alert.alertDate}</td>
+						<td>${alert.alertText}</a></td>
+					</tr>
+					</#if>
+			  		<#if x%2 == 1>
+					<tr class="dataRowOdd">
+						<td ${errorcls}>${alert.alertDate}</td>
+						<td>${alert.alertText}</a></td>
+					</tr>
+					</#if>
+					<#assign x = x + 1>
+				</#list>
+			</tbody>
+		
+		</table>
+	</div>
+
+<#else>
+	<div>
+	<p class="currentDocumentDescription">${message("deferredAlert.message.empty")}<br/></p>
+	</div>
+</#if>
+	
\ No newline at end of file
diff -r da9260dcce12 -r 02a9f35407df nuxeo-platform-alert-lock-core/pom.xml
--- a/nuxeo-platform-alert-lock-core/pom.xml	Thu Apr 01 05:22:58 2010 +0200
+++ b/nuxeo-platform-alert-lock-core/pom.xml	Thu Apr 01 05:25:45 2010 +0200
@@ -34,6 +34,10 @@
       <artifactId>nuxeo-platform-alert-api</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.nuxeo.ecm.platform</groupId>
+      <artifactId>nuxeo-platform-alert-util</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.nuxeo.theme</groupId>
       <artifactId>nuxeo-theme-core</artifactId>
     </dependency>
diff -r da9260dcce12 -r 02a9f35407df nuxeo-platform-alert-lock-core/src/main/java/org/nuxeo/ecm/alert/lock/core/LockAlertProvider.java
--- a/nuxeo-platform-alert-lock-core/src/main/java/org/nuxeo/ecm/alert/lock/core/LockAlertProvider.java	Thu Apr 01 05:22:58 2010 +0200
+++ b/nuxeo-platform-alert-lock-core/src/main/java/org/nuxeo/ecm/alert/lock/core/LockAlertProvider.java	Thu Apr 01 05:25:45 2010 +0200
@@ -16,6 +16,7 @@
 import org.nuxeo.ecm.alert.AlertContext;
 import org.nuxeo.ecm.alert.AlertProvider;
 import org.nuxeo.ecm.alert.UserAlerts;
+import org.nuxeo.ecm.alert.util.FreemarkerMethods;
 import org.nuxeo.ecm.core.api.ClientException;
 import org.nuxeo.ecm.core.api.CoreSession;
 import org.nuxeo.ecm.core.api.DocumentLocation;
@@ -164,6 +165,7 @@
             ctx.put("template", "lockAlert");
             ctx.put("docs", docs);
             ctx.put("format", w.getAlertDeliveryChannel());
+            FreemarkerMethods.add(ctx);
 
             Collection<RenderingResult> render = rs.process(ctx);
             if (render.size() > 0) {
diff -r da9260dcce12 -r 02a9f35407df nuxeo-platform-alert-lock-core/src/main/resources/OSGI-INF/deployment-fragment.xml
--- a/nuxeo-platform-alert-lock-core/src/main/resources/OSGI-INF/deployment-fragment.xml	Thu Apr 01 05:22:58 2010 +0200
+++ b/nuxeo-platform-alert-lock-core/src/main/resources/OSGI-INF/deployment-fragment.xml	Thu Apr 01 05:25:45 2010 +0200
@@ -15,6 +15,23 @@
 			<include>nuxeo.war/**</include>
 		</unzip>
 
+		<!--  create a temp dir -->
+		<!--  be sure no directory with that name exists -->
+		<delete path="${bundle.fileName}.tmp" />
+		<mkdir path="${bundle.fileName}.tmp" />
+
+		<unzip from="${bundle.fileName}" to="${bundle.fileName}.tmp">
+			<include>OSGI-INF/l10n/**</include>
+		</unzip>
+
+		<append from="${bundle.fileName}.tmp/OSGI-INF/l10n/messages.properties"
+			to="nuxeo.war/WEB-INF/classes/messages.properties" addNewLine="true" />
+		<append from="${bundle.fileName}.tmp/OSGI-INF/l10n/messages_en.properties"
+			to="nuxeo.war/WEB-INF/classes/messages_en.properties" addNewLine="true" />
+		<append from="${bundle.fileName}.tmp/OSGI-INF/l10n/messages_fr.properties"
+			to="nuxeo.war/WEB-INF/classes/messages_fr.properties" addNewLine="true" />
+
+		<delete path="${bundle.fileName}.tmp" />
 
 	</install>
 
diff -r da9260dcce12 -r 02a9f35407df nuxeo-platform-alert-lock-core/src/main/resources/OSGI-INF/l10n/messages.properties
--- a/nuxeo-platform-alert-lock-core/src/main/resources/OSGI-INF/l10n/messages.properties	Thu Apr 01 05:22:58 2010 +0200
+++ b/nuxeo-platform-alert-lock-core/src/main/resources/OSGI-INF/l10n/messages.properties	Thu Apr 01 05:25:45 2010 +0200
@@ -1,4 +1,4 @@
-label.content.header.sending_date=Sent
-label.content.header.sender=From
-label.content.header.subject=Subject
-action.view.mailcontent=Summary
\ No newline at end of file
+locked.message.title=Locked documents
+locked.message.since=Locked since
+locked.message.document=Document
+locked.message.empty=No locked documents
\ No newline at end of file
diff -r da9260dcce12 -r 02a9f35407df nuxeo-platform-alert-lock-core/src/main/resources/OSGI-INF/l10n/messages_en.properties
--- a/nuxeo-platform-alert-lock-core/src/main/resources/OSGI-INF/l10n/messages_en.properties	Thu Apr 01 05:22:58 2010 +0200
+++ b/nuxeo-platform-alert-lock-core/src/main/resources/OSGI-INF/l10n/messages_en.properties	Thu Apr 01 05:25:45 2010 +0200
@@ -1,4 +1,4 @@
-label.content.header.sending_date=Sent
-label.content.header.sender=From
-label.content.header.subject=Subject
-action.view.mailcontent=Summary
+locked.message.title=Locked documents
+locked.message.since=Locked since
+locked.message.document=Document
+locked.message.empty=No locked documents
\ No newline at end of file
diff -r da9260dcce12 -r 02a9f35407df nuxeo-platform-alert-lock-core/src/main/resources/OSGI-INF/l10n/messages_fr.properties
--- a/nuxeo-platform-alert-lock-core/src/main/resources/OSGI-INF/l10n/messages_fr.properties	Thu Apr 01 05:22:58 2010 +0200
+++ b/nuxeo-platform-alert-lock-core/src/main/resources/OSGI-INF/l10n/messages_fr.properties	Thu Apr 01 05:25:45 2010 +0200
@@ -1,4 +1,4 @@
-label.content.header.sending_date=Date d'envoi
-label.content.header.sender=De
-label.content.header.subject=Sujet
-action.view.mailcontent=Contenu
+locked.message.title=Documents verrouill�s
+locked.message.since=Depuis
+locked.message.document=Document
+locked.message.empty=Vouus n'avez aucun document verrouill�
\ No newline at end of file
diff -r da9260dcce12 -r 02a9f35407df nuxeo-platform-alert-lock-core/src/main/resources/templates/lockAlert.ftl
--- a/nuxeo-platform-alert-lock-core/src/main/resources/templates/lockAlert.ftl	Thu Apr 01 05:22:58 2010 +0200
+++ b/nuxeo-platform-alert-lock-core/src/main/resources/templates/lockAlert.ftl	Thu Apr 01 05:25:45 2010 +0200
@@ -1,35 +1,46 @@
 <div class="tabsBar">
-<ul><li class="selected"><a>Les documents que vous avez verrouillés</a></li></ul>
+<ul><li class="selected"><a>${message("locked.message.title")}</a></li></ul>
 </div>
-<div class="tabsContent">
-<table class="dataOutput">
-	<thead>
-		<tr>
-			<th width="100px">Depuis</th>
-			<th>Document</th>
-		</tr>
-	</thead>
-	<tbody>
+
+<#if docs?has_content>
+
+	<div class="tabsContent">
+	<table class="dataOutput">
+		<thead>
+			<tr>
+				<th width="100px">${message("locked.message.since")}</th>
+				<th>${message("locked.message.document")}</th>
+			</tr>
+		</thead>
+		<tbody>
+		
+			<#assign x = 1>
+		  	<#list docs as doc>  	
+			<#assign errorcls = "">
+		  		  		
+		  		<#if x%2 == 0>
+				<tr class="dataRowEven">
+					<td ${errorcls}>${doc.lockedSinceAsString}</td>
+					<td ${errorcls}><a href="${doc.docUrl}">${doc.docTitle}</a></td>
+				</tr>
+				</#if>
+		  		<#if x%2 == 1>
+				<tr class="dataRowOdd">
+					<td ${errorcls}>${doc.lockedSinceAsString}</td>
+					<td ${errorcls}><a href="${doc.docUrl}">${doc.docTitle}</a></td>
+				</tr>
+				</#if>
+				<#assign x = x + 1>
+			</#list>
+		</tbody>
 	
-		<#assign x = 1>
-	  	<#list docs as doc>  	
-		<#assign errorcls = "">
-	  		  		
-	  		<#if x%2 == 0>
-			<tr class="dataRowEven">
-				<td ${errorcls}>${doc.lockedSinceAsString}</td>
-				<td ${errorcls}><a href="${doc.docUrl}">${doc.docTitle}</a></td>
-			</tr>
-			</#if>
-	  		<#if x%2 == 1>
-			<tr class="dataRowOdd">
-				<td ${errorcls}>${doc.lockedSinceAsString}</td>
-				<td ${errorcls}><a href="${doc.docUrl}">${doc.docTitle}</a></td>
-			</tr>
-			</#if>
-			<#assign x = x + 1>
-		</#list>
-	</tbody>
+	</table>
+	</div>
 
-</table>
-</div>
+<#else>
+	
+	<div>
+	<p class="currentDocumentDescription">${message("locked.message.empty")}<br/></p>
+	</div>
+	
+</#if>
\ No newline at end of file
diff -r da9260dcce12 -r 02a9f35407df nuxeo-platform-alert-task-core/pom.xml
--- a/nuxeo-platform-alert-task-core/pom.xml	Thu Apr 01 05:22:58 2010 +0200
+++ b/nuxeo-platform-alert-task-core/pom.xml	Thu Apr 01 05:25:45 2010 +0200
@@ -35,6 +35,10 @@
       <artifactId>nuxeo-platform-alert-api</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.nuxeo.ecm.platform</groupId>
+      <artifactId>nuxeo-platform-alert-util</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.nuxeo.theme</groupId>
       <artifactId>nuxeo-theme-core</artifactId>
     </dependency>
diff -r da9260dcce12 -r 02a9f35407df nuxeo-platform-alert-task-core/src/main/java/org/nuxeo/ecm/alert/task/core/TaskAlertProvider.java
--- a/nuxeo-platform-alert-task-core/src/main/java/org/nuxeo/ecm/alert/task/core/TaskAlertProvider.java	Thu Apr 01 05:22:58 2010 +0200
+++ b/nuxeo-platform-alert-task-core/src/main/java/org/nuxeo/ecm/alert/task/core/TaskAlertProvider.java	Thu Apr 01 05:25:45 2010 +0200
@@ -13,6 +13,7 @@
 import org.nuxeo.ecm.alert.AlertContext;
 import org.nuxeo.ecm.alert.AlertProvider;
 import org.nuxeo.ecm.alert.UserAlerts;
+import org.nuxeo.ecm.alert.util.FreemarkerMethods;
 import org.nuxeo.ecm.core.api.ClientException;
 import org.nuxeo.ecm.core.api.CoreSession;
 import org.nuxeo.ecm.core.api.DocumentLocation;
@@ -103,6 +104,7 @@
             ctx.put("template", "taskAlert");
             ctx.put("docs", docs);
             ctx.put("format", w.getAlertDeliveryChannel());
+            FreemarkerMethods.add(ctx);
 
             Collection<RenderingResult> render = rs.process(ctx);
             if (render.size() > 0) {
diff -r da9260dcce12 -r 02a9f35407df nuxeo-platform-alert-task-core/src/main/resources/OSGI-INF/deployment-fragment.xml
--- a/nuxeo-platform-alert-task-core/src/main/resources/OSGI-INF/deployment-fragment.xml	Thu Apr 01 05:22:58 2010 +0200
+++ b/nuxeo-platform-alert-task-core/src/main/resources/OSGI-INF/deployment-fragment.xml	Thu Apr 01 05:25:45 2010 +0200
@@ -8,4 +8,26 @@
 		</module>
 	</extension>
 
+	<install>
+		<!--  create a temp dir -->
+		<!--  be sure no directory with that name exists -->
+		<delete path="${bundle.fileName}.tmp" />
+		<mkdir path="${bundle.fileName}.tmp" />
+
+		<unzip from="${bundle.fileName}" to="${bundle.fileName}.tmp">
+			<include>OSGI-INF/l10n/**</include>
+		</unzip>
+
+		<append from="${bundle.fileName}.tmp/OSGI-INF/l10n/messages.properties"
+			to="nuxeo.war/WEB-INF/classes/messages.properties" addNewLine="true" />
+		<append from="${bundle.fileName}.tmp/OSGI-INF/l10n/messages_en.properties"
+			to="nuxeo.war/WEB-INF/classes/messages_en.properties" addNewLine="true" />
+		<append from="${bundle.fileName}.tmp/OSGI-INF/l10n/messages_fr.properties"
+			to="nuxeo.war/WEB-INF/classes/messages_fr.properties" addNewLine="true" />
+
+		<delete path="${bundle.fileName}.tmp" />
+
+	</install>
+
+
 </fragment>
diff -r da9260dcce12 -r 02a9f35407df nuxeo-platform-alert-task-core/src/main/resources/OSGI-INF/l10n/messages.properties
--- a/nuxeo-platform-alert-task-core/src/main/resources/OSGI-INF/l10n/messages.properties	Thu Apr 01 05:22:58 2010 +0200
+++ b/nuxeo-platform-alert-task-core/src/main/resources/OSGI-INF/l10n/messages.properties	Thu Apr 01 05:25:45 2010 +0200
@@ -1,4 +1,4 @@
-label.content.header.sending_date=Sent
-label.content.header.sender=From
-label.content.header.subject=Subject
-action.view.mailcontent=Summary
\ No newline at end of file
+task.message.title=Your tasks
+task.message.duedate=Due date
+task.message.document=Document
+task.message.empty=No pending task
\ No newline at end of file
diff -r da9260dcce12 -r 02a9f35407df nuxeo-platform-alert-task-core/src/main/resources/OSGI-INF/l10n/messages_en.properties
--- a/nuxeo-platform-alert-task-core/src/main/resources/OSGI-INF/l10n/messages_en.properties	Thu Apr 01 05:22:58 2010 +0200
+++ b/nuxeo-platform-alert-task-core/src/main/resources/OSGI-INF/l10n/messages_en.properties	Thu Apr 01 05:25:45 2010 +0200
@@ -1,4 +1,4 @@
-label.content.header.sending_date=Sent
-label.content.header.sender=From
-label.content.header.subject=Subject
-action.view.mailcontent=Summary
+task.message.title=Your tasks
+task.message.duedate=Due date
+task.message.document=Document
+task.message.empty=No pending task
\ No newline at end of file
diff -r da9260dcce12 -r 02a9f35407df nuxeo-platform-alert-task-core/src/main/resources/OSGI-INF/l10n/messages_fr.properties
--- a/nuxeo-platform-alert-task-core/src/main/resources/OSGI-INF/l10n/messages_fr.properties	Thu Apr 01 05:22:58 2010 +0200
+++ b/nuxeo-platform-alert-task-core/src/main/resources/OSGI-INF/l10n/messages_fr.properties	Thu Apr 01 05:25:45 2010 +0200
@@ -1,4 +1,4 @@
-label.content.header.sending_date=Date d'envoi
-label.content.header.sender=De
-label.content.header.subject=Sujet
-action.view.mailcontent=Contenu
+task.message.title=Vos t�ches
+task.message.duedate=Ech�ance
+task.message.document=Document
+task.message.empty=Aucune t�che ne vous est affect�e
\ No newline at end of file
diff -r da9260dcce12 -r 02a9f35407df nuxeo-platform-alert-task-core/src/main/resources/templates/taskAlert.ftl
--- a/nuxeo-platform-alert-task-core/src/main/resources/templates/taskAlert.ftl	Thu Apr 01 05:22:58 2010 +0200
+++ b/nuxeo-platform-alert-task-core/src/main/resources/templates/taskAlert.ftl	Thu Apr 01 05:25:45 2010 +0200
@@ -1,40 +1,51 @@
 <div class="tabsBar">
-<ul><li class="selected"><a>Les tâches qui vous sont affectées</a></li></ul>
+<ul><li class="selected"><a>${message("task.message.title")}</a></li></ul>
 </div>
-<div class="tabsContent">
-<table class="dataOutput">
-	<thead>
-		<tr>
-			<th width="100px" >Echéance</th>
-			<th>Document</th>
-		</tr>
-	</thead>
-	<tbody>
+
+<#if docs?has_content>
+
+	<div class="tabsContent">
+	<table class="dataOutput">
+		<thead>
+			<tr>
+				<th width="100px" >${message("task.message.duedate")}</th>
+				<th>${message("task.message.document")}</th>
+			</tr>
+		</thead>
+		<tbody>
+		
+			<#assign x = 1>
+		  	<#list docs as doc>  
+		  	
+		  		<#if doc.late>
+		  			<#assign errorcls = "class=\"error\"">
+		  		<#else>
+		  			<#assign errorcls = "">
+		  		</#if>
+		  			
+		  		<#if x%2 == 0>
+				<tr class="dataRowEven">
+					<td ${errorcls}>${doc.dueDateStr}</td>
+					<td><a href="${doc.docUrl}">${doc.docTitle}</a></td>
+				</tr>
+				</#if>
+		  		<#if x%2 == 1>
+				<tr class="dataRowOdd">
+					<td ${errorcls}>${doc.dueDateStr}</td>
+					<td><a href="${doc.docUrl}">${doc.docTitle}</a></td>
+				</tr>
+				</#if>
+				<#assign x = x + 1>
+			</#list>
+		</tbody>
 	
-		<#assign x = 1>
-	  	<#list docs as doc>  
-	  	
-	  		<#if doc.late>
-	  			<#assign errorcls = "class=\"error\"">
-	  		<#else>
-	  			<#assign errorcls = "">
-	  		</#if>
-	  			
-	  		<#if x%2 == 0>
-			<tr class="dataRowEven">
-				<td ${errorcls}>${doc.dueDateStr}</td>
-				<td><a href="${doc.docUrl}">${doc.docTitle}</a></td>
-			</tr>
-			</#if>
-	  		<#if x%2 == 1>
-			<tr class="dataRowOdd">
-				<td ${errorcls}>${doc.dueDateStr}</td>
-				<td><a href="${doc.docUrl}">${doc.docTitle}</a></td>
-			</tr>
-			</#if>
-			<#assign x = x + 1>
-		</#list>
-	</tbody>
+	</table>
+	</div>
 
-</table>
-</div>
+<#else>
+	
+	<div>
+	<p class="currentDocumentDescription">${message("task.message.empty")}<br/></p>
+	</div>
+	
+</#if>
\ No newline at end of file
# HG changeset patch
# User Christophe Capon <christophe.capon@vilogia.fr>
# Date 1270092698 -7200
# Branch 5.3.0
# Node ID 30115d3f222047f114adb2bf6a9d2a27a987772e
# Parent  02a9f35407df4c98bd1735caf6c531827562714d
Allow to select alert provider order in the alert mail

diff -r 02a9f35407df -r 30115d3f2220 nuxeo-platform-alert-core/src/main/java/org/nuxeo/ecm/alert/core/AlertManagementServiceImpl.java
--- a/nuxeo-platform-alert-core/src/main/java/org/nuxeo/ecm/alert/core/AlertManagementServiceImpl.java	Thu Apr 01 05:25:45 2010 +0200
+++ b/nuxeo-platform-alert-core/src/main/java/org/nuxeo/ecm/alert/core/AlertManagementServiceImpl.java	Thu Apr 01 05:31:38 2010 +0200
@@ -20,8 +20,12 @@
 package org.nuxeo.ecm.alert.core;
 
 import java.io.BufferedReader;
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -29,9 +33,12 @@
 import java.util.Map;
 import java.util.Map.Entry;
 
+import javax.xml.parsers.ParserConfigurationException;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.jboss.seam.international.Messages;
+import org.nuxeo.common.xmap.XMap;
 import org.nuxeo.ecm.alert.Alert;
 import org.nuxeo.ecm.alert.AlertContext;
 import org.nuxeo.ecm.alert.AlertEvent;
@@ -79,8 +86,12 @@
 
     private static final Log log = LogFactory.getLog(AlertManagementServiceImpl.class);
 
+    private Boolean rankLoaded = false;
+
     private Map<String, AlertProvider> alertProviders = new HashMap<String, AlertProvider>();
 
+    private List<AlertProvider> sortedProviders = new ArrayList<AlertProvider>();
+
     private RenderingService rs = null;
 
     private EmailHelper helper = null;
@@ -93,6 +104,17 @@
 
     private static UserSettingsService userSettingsService = null;
 
+    private static XMap xmap = null;
+
+    private void initXmap() {
+
+        if (xmap == null) {
+            log.info("Initialize XMap for configuration file");
+            xmap = new XMap();
+            xmap.register(AlertProviderRanking.class);
+        }
+    }
+
     private static UserSettingsService getUserSettingsService()
             throws Exception {
 
@@ -111,6 +133,8 @@
 
         try {
 
+            loadRanks();
+
             CoreSession coreSession = ctx.getEvent().getContext().getCoreSession();
 
             init(ctx);
@@ -132,6 +156,67 @@
 
     }
 
+    private void loadRanks() {
+
+        if (!rankLoaded) {
+
+            try {
+
+                initXmap();
+
+                AlertProviderRanking rank = loadRankingFromConfig();
+
+                if (null != rank) {
+                    
+                    for (String p : rank.provider) {
+                        if (alertProviders.containsKey(p)) {
+                            AlertProvider pr = alertProviders.get(p);
+                            if (!sortedProviders.contains(pr))
+                                sortedProviders.add(pr);
+                        }
+                    }
+
+                }
+                
+                Iterator<Entry<String, AlertProvider>> it = alertProviders.entrySet().iterator();
+                while (it.hasNext()) {
+                    Entry<String, AlertProvider> item = it.next();
+                    if (!sortedProviders.contains(item.getValue()))
+                        sortedProviders.add(item.getValue());
+                }
+
+            } catch (Exception e) {
+
+                sortedProviders = new ArrayList<AlertProvider>();
+
+                Iterator<Entry<String, AlertProvider>> it = alertProviders.entrySet().iterator();
+                while (it.hasNext()) {
+                    Entry<String, AlertProvider> item = it.next();
+                    sortedProviders.add(item.getValue());
+                }
+
+            }
+
+            rankLoaded = true;
+        }
+
+    }
+
+    private AlertProviderRanking loadRankingFromConfig() {
+
+        AlertProviderRanking result = null;
+
+        try {
+            URL url = getClass().getResource(
+                    "/config/alert-providers-ranking.xml");
+            Object[] config = (Object[]) xmap.loadAll(url);
+            if (config.length > 0)
+                result = (AlertProviderRanking) config[0];
+        } catch (Exception e) {
+        }
+        return result;
+    }
+
     private void init(AlertContext ctx) throws Exception {
 
         if (rs == null) {
@@ -282,7 +367,7 @@
             throws Exception {
 
         DocumentModel userSettingsDoc = getUserSettingsService().getUserSettings(
-                coreSession, "AlertSettings").get(0);
+                coreSession, userName, "AlertSettings").get(0);
         AlertSettingsWrapper settings = new AlertSettingsWrapper(
                 userSettingsDoc);
 
@@ -303,7 +388,10 @@
 
         if (go) {
 
-            Iterator<Entry<String, AlertProvider>> iter = alertProviders.entrySet().iterator();
+            Iterator<AlertProvider> iter = sortedProviders.iterator();
+
+            // Iterator<Entry<String, AlertProvider>> iter =
+            // alertProviders.entrySet().iterator();
 
             StringBuilder bdr = new StringBuilder();
 
@@ -311,10 +399,10 @@
 
             while (iter.hasNext()) {
 
-                Entry<String, AlertProvider> item = iter.next();
+                AlertProvider item = iter.next();
 
-                String render = item.getValue().renderAlerts(coreSession, rs,
-                        userName, alerts, userSettingsDoc, ctx);
+                String render = item.renderAlerts(coreSession, rs, userName,
+                        alerts, userSettingsDoc, ctx);
 
                 bdr.append(render);
 
diff -r 02a9f35407df -r 30115d3f2220 nuxeo-platform-alert-core/src/main/java/org/nuxeo/ecm/alert/core/AlertProviderRanking.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nuxeo-platform-alert-core/src/main/java/org/nuxeo/ecm/alert/core/AlertProviderRanking.java	Thu Apr 01 05:31:38 2010 +0200
@@ -0,0 +1,15 @@
+package org.nuxeo.ecm.alert.core;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.nuxeo.common.xmap.annotation.XNodeList;
+import org.nuxeo.common.xmap.annotation.XObject;
+
+@XObject("providerRanking")
+public class AlertProviderRanking {
+
+    @XNodeList(value="provider", type=ArrayList.class, componentType=String.class)
+    public List<String> provider;
+
+}
diff -r 02a9f35407df -r 30115d3f2220 nuxeo-platform-alert-core/src/test/resources/config/alert-providers-ranking.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nuxeo-platform-alert-core/src/test/resources/config/alert-providers-ranking.xml	Thu Apr 01 05:31:38 2010 +0200
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<root>
+    <providerRanking>
+	<provider>provider2</provider>
+	<provider>provider1</provider>
+    </providerRanking>
+</root>
# HG changeset patch
# User Christophe Capon <christophe.capon@vilogia.fr>
# Date 1270092734 -7200
# Branch 5.3.0
# Node ID 9aaeeb2258c561b39452c81658948d090448f3b5
# Parent  30115d3f222047f114adb2bf6a9d2a27a987772e
Better session management

diff -r 30115d3f2220 -r 9aaeeb2258c5 nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/defer/DeferredNotificationHelper.java
--- a/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/defer/DeferredNotificationHelper.java	Thu Apr 01 05:31:38 2010 +0200
+++ b/nuxeo-platform-notification-core/src/main/java/org/nuxeo/ecm/platform/ec/notification/defer/DeferredNotificationHelper.java	Thu Apr 01 05:32:14 2010 +0200
@@ -19,38 +19,26 @@
 
 package org.nuxeo.ecm.platform.ec.notification.defer;
 
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.io.Writer;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
-import javax.mail.Message;
-import javax.mail.Session;
-import javax.mail.Transport;
-import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeMessage;
-import javax.naming.InitialContext;
 import javax.security.auth.login.LoginContext;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.nuxeo.ecm.core.api.CoreInstance;
 import org.nuxeo.ecm.core.api.CoreSession;
 import org.nuxeo.ecm.core.api.DocumentModel;
 import org.nuxeo.ecm.deferredalert.DeferredAlertManagementService;
 import org.nuxeo.ecm.platform.ec.notification.NotificationConstants;
-import org.nuxeo.ecm.platform.ec.notification.service.NotificationService;
-import org.nuxeo.ecm.platform.ec.notification.service.NotificationServiceHelper;
 import org.nuxeo.ecm.platform.rendering.RenderingResult;
 import org.nuxeo.ecm.platform.rendering.RenderingService;
 import org.nuxeo.ecm.platform.rendering.impl.DocumentRenderingContext;
 import org.nuxeo.runtime.api.Framework;
 
 import freemarker.template.Configuration;
-import freemarker.template.Template;
 
 /**
  * Class EmailHelper.
@@ -108,6 +96,8 @@
         DocumentRenderingContext context = new DocumentRenderingContext();
         context.remove("doc");
         context.putAll(mail);
+        String sid = (String)mail.get("sessionId");
+        CoreSession coreSession = CoreInstance.getInstance().getSession(sid);
         context.setDocument((DocumentModel) mail.get("document"));
 
         rs.registerEngine(new DeferredNotificationsRenderingEngine(
@@ -125,9 +115,7 @@
         List<String> alerts = new ArrayList<String>();
         alerts.add(bodyMail);
 
-        CoreSession session = ((DocumentModel) mail.get("document")).getCoreSession();
-        
-        getService().storeAlerts(userPrincipal, alerts, session);
+        getService().storeAlerts(userPrincipal, alerts, coreSession);
 
         lc.logout();
 
# HG changeset patch
# User Christophe Capon <christophe.capon@vilogia.fr>
# Date 1270092767 -7200
# Branch 5.3.0
# Node ID fbe6ac37fd98463f7b3d8ab2a71e57d7a42be8ab
# Parent  9aaeeb2258c561b39452c81658948d090448f3b5
Added support for expired document

diff -r 9aaeeb2258c5 -r fbe6ac37fd98 nuxeo-platform-usersettings-alert-types/src/main/java/org/nuxeo/em/usersettings/alert/types/AlertSettingsType.java
--- a/nuxeo-platform-usersettings-alert-types/src/main/java/org/nuxeo/em/usersettings/alert/types/AlertSettingsType.java	Thu Apr 01 05:32:14 2010 +0200
+++ b/nuxeo-platform-usersettings-alert-types/src/main/java/org/nuxeo/em/usersettings/alert/types/AlertSettingsType.java	Thu Apr 01 05:32:47 2010 +0200
@@ -14,6 +14,10 @@
 
     public static final String PROP_INCLUDE_FUTURE_TASKS = "includeFutureTasks";
 
+    public static final String PROP_INCLUDE_EXPIRED_DOCUMENTS_DELAY = "includeExpiredDocumentsDelay";
+
+    public static final String PROP_INCLUDE_EXPIRED_DOCUMENTS = "includeExpiredDocuments";
+
     public static final String PROP_SUMMARY_FREQUENCY = "summaryFrequency";
 
     public static final String PROP_NOTIFICATION_POLICY = "notificationPolicy";
diff -r 9aaeeb2258c5 -r fbe6ac37fd98 nuxeo-platform-usersettings-alert-types/src/main/java/org/nuxeo/em/usersettings/alert/types/AlertSettingsWrapper.java
--- a/nuxeo-platform-usersettings-alert-types/src/main/java/org/nuxeo/em/usersettings/alert/types/AlertSettingsWrapper.java	Thu Apr 01 05:32:14 2010 +0200
+++ b/nuxeo-platform-usersettings-alert-types/src/main/java/org/nuxeo/em/usersettings/alert/types/AlertSettingsWrapper.java	Thu Apr 01 05:32:47 2010 +0200
@@ -93,4 +93,28 @@
         return (String) doc.getProperty(AlertSettingsType.SCHEMA,
                 AlertSettingsType.PROP_ALERT_CHANNEL);
     }
+
+    public void setIncludeExpiredDocuments(Boolean includeExpiredDocuments)
+            throws ClientException {
+        doc.setProperty(AlertSettingsType.SCHEMA,
+                AlertSettingsType.PROP_INCLUDE_EXPIRED_DOCUMENTS, includeExpiredDocuments);
+    }
+
+    public Boolean getIncludeExpiredDocuments() throws ClientException {
+        return (Boolean) doc.getProperty(AlertSettingsType.SCHEMA,
+                AlertSettingsType.PROP_INCLUDE_EXPIRED_DOCUMENTS);
+    }
+
+    public void setIncludeExpiredDocumentsDelay(Long includeExpiredDocumentsDelay)
+            throws ClientException {
+        doc.setProperty(AlertSettingsType.SCHEMA,
+                AlertSettingsType.PROP_INCLUDE_EXPIRED_DOCUMENTS_DELAY,
+                includeExpiredDocumentsDelay);
+    }
+
+    public Long getIncludeExpiredDocumentsDelay() throws ClientException {
+        return (Long) doc.getProperty(AlertSettingsType.SCHEMA,
+                AlertSettingsType.PROP_INCLUDE_EXPIRED_DOCUMENTS_DELAY);
+    }
+
 }
diff -r 9aaeeb2258c5 -r fbe6ac37fd98 nuxeo-platform-usersettings-alert-types/src/main/resources/schemas/AlertSettings.xsd
--- a/nuxeo-platform-usersettings-alert-types/src/main/resources/schemas/AlertSettings.xsd	Thu Apr 01 05:32:14 2010 +0200
+++ b/nuxeo-platform-usersettings-alert-types/src/main/resources/schemas/AlertSettings.xsd	Thu Apr 01 05:32:47 2010 +0200
@@ -20,4 +20,9 @@
 	<!-- Include tasks without due date in the summary mail -->	
 	<xs:element name="includeTasksWithoutDueDate" type="xs:boolean" default="true" />
 
+	<!-- Include future tasks in the summary mail, depending on the specified delay  -->
+	<xs:element name="includeExpiredDocuments" type="xs:boolean" default="false" />
+	<xs:element name="includeExpiredDocumentsDelay" type="xs:integer" default="7" />
+
+
 </xs:schema>
diff -r 9aaeeb2258c5 -r fbe6ac37fd98 nuxeo-platform-usersettings-alert-types/src/test/java/com/nuxeo/ecm/alertsettings/types/TestAlertSettings.java
--- a/nuxeo-platform-usersettings-alert-types/src/test/java/com/nuxeo/ecm/alertsettings/types/TestAlertSettings.java	Thu Apr 01 05:32:14 2010 +0200
+++ b/nuxeo-platform-usersettings-alert-types/src/test/java/com/nuxeo/ecm/alertsettings/types/TestAlertSettings.java	Thu Apr 01 05:32:47 2010 +0200
@@ -110,6 +110,8 @@
         assertEquals(TEST_USERNAME1, w.getUser());
         assertFalse(w.getIncludeFutureTasks());
         assertTrue(20L == w.getIncludeFutureTasksDelay());
+        assertTrue(w.getIncludeExpiredDocuments());
+        assertTrue(30L == w.getIncludeExpiredDocumentsDelay());
         assertFalse(w.getIncludeTasksWithoutDueDate());
         assertEquals(AlertSettingsType.NOTIFICATION_POLICY_BOTH,
                 w.getNotificationPolicy());
@@ -136,6 +138,10 @@
         testDoc.setProperty(AlertSettingsType.SCHEMA,
                 AlertSettingsType.PROP_INCLUDE_FUTURE_TASKS_DELAY, 20);
         testDoc.setProperty(AlertSettingsType.SCHEMA,
+                AlertSettingsType.PROP_INCLUDE_EXPIRED_DOCUMENTS, true);
+        testDoc.setProperty(AlertSettingsType.SCHEMA,
+                AlertSettingsType.PROP_INCLUDE_EXPIRED_DOCUMENTS_DELAY, 30);
+        testDoc.setProperty(AlertSettingsType.SCHEMA,
                 AlertSettingsType.PROP_INCLUDE_TASKS_WITHOUT_DUE_DATE, false);
         testDoc.setProperty(AlertSettingsType.SCHEMA,
                 AlertSettingsType.PROP_NOTIFICATION_POLICY,
diff -r 9aaeeb2258c5 -r fbe6ac37fd98 nuxeo-platform-usersettings-alert-web/src/main/resources/OSGI-INF/l10n/messages.properties
--- a/nuxeo-platform-usersettings-alert-web/src/main/resources/OSGI-INF/l10n/messages.properties	Thu Apr 01 05:32:14 2010 +0200
+++ b/nuxeo-platform-usersettings-alert-web/src/main/resources/OSGI-INF/l10n/messages.properties	Thu Apr 01 05:32:47 2010 +0200
@@ -7,3 +7,5 @@
 label.alertsettings.includeTasksWithoutDueDate=Include tasks without date
 label.alertsettings.notificationPolicy=Notify me... 
 label.alertsettings.alertChannel=Alert Delivery Channel
+label.alertsettings.includeExpiredDocuments=Include expired documents
+label.alertsettings.includeExpiredDocumentsDelay=Expiring until
diff -r 9aaeeb2258c5 -r fbe6ac37fd98 nuxeo-platform-usersettings-alert-web/src/main/resources/OSGI-INF/l10n/messages_en.properties
--- a/nuxeo-platform-usersettings-alert-web/src/main/resources/OSGI-INF/l10n/messages_en.properties	Thu Apr 01 05:32:14 2010 +0200
+++ b/nuxeo-platform-usersettings-alert-web/src/main/resources/OSGI-INF/l10n/messages_en.properties	Thu Apr 01 05:32:47 2010 +0200
@@ -7,3 +7,5 @@
 label.alertsettings.includeTasksWithoutDueDate=Include tasks without date
 label.alertsettings.notificationPolicy=Notify me... 
 label.alertsettings.alertChannel=Alert Delivery Channel
+label.alertsettings.includeExpiredDocuments=Include expired documents
+label.alertsettings.includeExpiredDocumentsDelay=Expiring until
diff -r 9aaeeb2258c5 -r fbe6ac37fd98 nuxeo-platform-usersettings-alert-web/src/main/resources/OSGI-INF/l10n/messages_fr.properties
--- a/nuxeo-platform-usersettings-alert-web/src/main/resources/OSGI-INF/l10n/messages_fr.properties	Thu Apr 01 05:32:14 2010 +0200
+++ b/nuxeo-platform-usersettings-alert-web/src/main/resources/OSGI-INF/l10n/messages_fr.properties	Thu Apr 01 05:32:47 2010 +0200
@@ -7,3 +7,5 @@
 label.alertsettings.includeTasksWithoutDueDate=Inclure les t�ches sans �ch�ance
 label.alertsettings.notificationPolicy=Me pr�venir...
 label.alertsettings.alertChannel=Acheminement des alertes
+label.alertsettings.includeExpiredDocuments=Inclure les documents expir�s
+label.alertsettings.includeExpiredDocumentsDelay=et expirant jusqu'�
diff -r 9aaeeb2258c5 -r fbe6ac37fd98 nuxeo-platform-usersettings-alert-web/src/main/resources/OSGI-INF/usersettings-alert-layouts-contrib.xml
--- a/nuxeo-platform-usersettings-alert-web/src/main/resources/OSGI-INF/usersettings-alert-layouts-contrib.xml	Thu Apr 01 05:32:14 2010 +0200
+++ b/nuxeo-platform-usersettings-alert-web/src/main/resources/OSGI-INF/usersettings-alert-layouts-contrib.xml	Thu Apr 01 05:32:47 2010 +0200
@@ -30,7 +30,10 @@
 				<row>
 					<widget>chkIncludeTasksWithoutDueDate</widget>
 				</row>
-
+				<row>
+					<widget>chkIncludeExpiredDocuments</widget>
+					<widget>intIncludeExpiredDocumentsDelay</widget>
+				</row>
 			</rows>
 
 			<widget name="lstAlertChannel" type="selectOneDirectory">
@@ -120,6 +123,27 @@
 				</fields>
 			</widget>
 
+			<widget name="chkIncludeExpiredDocuments" type="checkbox">
+				<labels>
+					<label mode="any">label.alertsettings.includeExpiredDocuments
+					</label>
+				</labels>
+				<translated>true</translated>
+				<fields>
+					<field>alert:includeExpiredDocuments</field>
+				</fields>
+			</widget>
+
+			<widget name="intIncludeExpiredDocumentsDelay" type="text">
+				<labels>
+					<label mode="any">label.alertsettings.includeExpiredDocumentsDelay
+					</label>
+				</labels>
+				<translated>true</translated>
+				<fields>
+					<field>alert:includeExpiredDocumentsDelay</field>
+				</fields>
+			</widget>
 
 		</layout>
 
